export = function () {
    return (hook: any) => {
        const app = hook.app
        const id = hook.result.id
        let payload = { userId: id }
        let options = app.get('auth')
        return app.passport.createJWT(payload, options).then((accessToken: string) => {
            hook.result.accessToken = accessToken
            console.log('issueJWT ' + accessToken)
            return Promise.resolve(hook)
        })
    }
}